<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<jsp:directive.page import="com.hertz.alarm.dao.EhCacheDao"/>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>ehcache</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

  </head>
  
  <body>
  <% 
  	ApplicationContext context=WebApplicationContextUtils.getWebApplicationContext(application);
    EhCacheDao ehDao = (EhCacheDao)context.getBean("ehCacheDao");
    out.println();
  	String region = request.getParameter("region");
  	String key = request.getParameter("key");
  	if (region != null && key != null) {
  		Object obj = ehDao.get(key, region);
  		out.println(obj);
  		out.println("</p>");
  	}
  %>
  EHCACHE index search:
  <form action="">
  	region:<input type="text" name="region" value="<%=region%>"><br>
  	key:   <input type="text" name="key" value="<%=key%>"><br>
  	       <input type="submit" name="submit"><br>
  </form>
  <%
    String[] arr = ehDao.cacheManager.getCacheNames();
    for (String temp : arr ) {
    	out.println(temp + "<br>");
    }
  %>
    
  </body>
</html>
